﻿Partial Class Login
    Inherits BasePage

#Region "Atributos da pagina"

#End Region

#Region "Delegates"

    Protected Delegate Sub PageDelegate()

#End Region

#Region "Classes Injetadas"

#End Region

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim _autenticado As Boolean

        If Not IsPostBack Then
            ' Valida se o usuário já está autenticado

            _autenticado = Boolean.TryParse(Session(ChaveSession.UsuarioLogado), False)

            If Session(ChaveSession.UsuarioLogado) = True Then
                Response.Redirect(AppPaginas.PaginaInicial)
            End If

        End If

    End Sub

#Region "Funcoes de Databind"

#End Region

#Region "Operacoes do Usuario"

    Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click

        ' TODO: Implementar camada de acesso.Usuario, validação de login, usuário bloqueado, etc.

        Session(ChaveSession.UsuarioLogado) = True

        'Throw New NotImplementedException("Teste ErrorLog")

        Response.Redirect(AppPaginas.PaginaInicial)

    End Sub

#End Region

#Region "Classes Auxiliares"

#End Region

End Class
